home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 July
/
Macworld (1999-07).dmg
/
Shareware World
/
Info
/
For Developers
/
Mops 3.4.sea
/
Quick Edit ƒ
/
Subject Glossary
/
Strings
< prev
next >
Wrap
Text File
|
1992-11-29
|
3KB
|
77 lines
STRING -- : name
A standard class. This class is changed radically from Neon! We now keep
two offsets into a string - POS and LIM. POS marks the "current" position,
and LIM the "current" end. Most string operations operate on the substring
delimited by POS and LIM, which we call the active part of the string. We
also keep the size of the string (the real size, that is) in an ivar, so
that we can get it quickly without a system call. See also class string+.
STRING+ -- : name
A standard class, subclass of string. Provides many extensions.
" Standard delimiter.
& -- n : char
Leave ascii value of next char in stream. Same as ascii.
." Will print to the console text delimited by ".
ASCII -- n : char
Leave ascii value of next char in stream. Same as &.
BL -- 32 A constant.
BLANKS addr n --
Fills memory with blanks (ascii 32) starting at addr for n bytes.
RET -- 13
A constant, returns ascii value of a carriage return character.
," -- Add text till " to the dictionary.
,"STR" -- Adds text delimited by " at the start and end.
STRING COMPARISONS
CASE? -- b
A value. True if case to be significant in comparisons done by CMPSTR and
string+ objects (does not affect string objects).
CMPSTR addr1 len1 addr2 len2 -- n
Compares 2 strings. Case is significant if CASE? is set to true. Returns:
-1 if first string low, 0 if strings are equal, 1 if first string high. We
assume the lengths are both less than 64K.
$= addr1 len1 addr2 len2 -- result
Compares string1 to string2, both given as the first byte of text (addr)
and the number of bytes to compare (len). Essentially used to do
alphabetical sorts with a being less than b and so forth, but note that a
(ascii 97) still is "less than" B (ascii 66). Although A will be less than
a. Result = -1 if string1 is less than string2, = 0 if strings are equal,
= 1 if string 1 is greater than string2. A Toolbox call to IUMagString.
See IM for complete detail.
S= addr1 len1 addr2 len2 -- b
Case sensitive string comparison, true if equal.
PASCAL TYPE COUNTED STRINGS
>STR255 addr1 len addr2 -- addr2
Converts text beginning at addr1 for len characters to a str255 type string
at addr2.
BUF255 -- addr A 256-byte buffer for str255 operations.
COUNT str255 -- addr len
Converts a Pascal type string ( str255 ) to the addr len format.
STR255 addr len -- ^buf255
Converts text beginning at addr for len characters to a str255 type string
at buf255, leaving the addr of buf255. Note that you should use the string
right away as the next call to str255 will overwrite the buffer.
STRING CONSTANTS
SCON -- : name text
Defines a string constant. Change from Neon: the first nonblank char after
the name of the SCON is the delimiter. So " can be used as usual, but
anything else can be used instead, e.g.: scon <name> /string containing "
as non-delimiter/ Example: scon myscon "test"
INSTEAD c-old c-new --
May be used just after a SCON is defined. Within the SCON, it replaces any
occurrences of c-old with c-new. This operation is useful for creating
SCONs containing special characters such as tab.